package cn.javass.struts2impl.i18n;

import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;

public class Test {
    public static void main(String[] args) {
        // 选择中文
        Locale locale1 = Locale.SIMPLIFIED_CHINESE;
        // 选择i18n这组文件
        ResourceBundle bundle1 = ResourceBundle.getBundle("i18n", locale1);
        // 选择其中的lablea这一项
        System.out.println("bundle1==" + bundle1.getString("labela"));
        // 将参数合成进读出的国际化信息
        String message = bundle1.getString("labelc");
        String[] params = {"小明", "20130401001"};
        System.out.println(MessageFormat.format(message, params));
        
        Locale locale2 = Locale.US;
        ResourceBundle bundle2 = ResourceBundle.getBundle("i18n", locale2);
        System.out.println("bundle2==" + bundle2.getString("labela"));

        Locale locale3 = Locale.FRANCE;
        ResourceBundle bundle3 = ResourceBundle.getBundle("i18n", locale3);
        System.out.println("bundle3==" + bundle3.getString("labela"));

    }

}
